package com.usian.controller;

import com.usian.pojo.TbItemParam;
import com.usian.service.ItemService;
import com.usian.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/service/itemParam")
@RestController
public class ItemParamController {

    @Autowired
    private ItemService itemService;

    /**
     * 根据商品分类 ID 查询规格参数模板
     */
    @RequestMapping("selectItemParamByItemCatId")
    public TbItemParam selectItemParamByItemCatId(long itemCatId){
        return itemService.selectItemParamByItemCatId(itemCatId);
    }

    @RequestMapping("selectItemParamAll")
    public PageResult selectItemParamAll(@RequestParam Integer page, @RequestParam Integer rows){
        return itemService.selectItemParamAll(page,rows);
    }


    @RequestMapping("insertItemParam")
    public Integer insertItemParam(@RequestParam Integer itemCatId,@RequestParam String paramData){
        return itemService.insertItemParam(itemCatId,paramData);
    }

    @RequestMapping("deleteItemParamById")
    public Integer deleteItemParamById(@RequestParam Integer id){
        return itemService.deleteItemParamById(id);
    }
}
